package com.itheima.project_cloth.mapper;

import com.itheima.project_cloth.pojo.OrderMerchant;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface OrderMerchantMapper {

    @Select("select * from tb_order_merchant where name = #{name}")
    OrderMerchant selectOrderMerchantByName(String name);

    @Select("select * from tb_order_merchant where cloth_id = #{id}")
    List<OrderMerchant> selectOrderMerchantByCloth(Integer id);

    @Insert("insert into tb_order_merchant (name,begin_time,finish_time,source,cloth_id,cloth_num) values (#{name},#{beginTime},#{finishTime},#{source},#{clothId},#{clothNum})")
    void insertOrderMerchan(OrderMerchant orderMerchant);
    @Select("select * from tb_order_merchant where begin_time between #{beginTime} and #{endTime}")
    List<OrderMerchant> selectByTime(LocalDateTime beginTime, LocalDateTime endTime);
}
